package org.acompanhamento.domain;

import static javax.persistence.FetchType.LAZY;

import java.util.Collections;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import jmine.tec.aom.domain.Property;
import jmine.tec.persist.annotation.Alias;
import jmine.tec.persist.annotation.Index;

import org.hibernate.annotations.Type;

import bancosys.tec.component.Documentation;
import bancosys.tec.utils.date.Date;

@Entity
@Table(name = "UPDATING_TASK")
@Alias("UPDTAS")
@Documentation("UPDATING TASK")
@SequenceGenerator(name = "SEQ_UPDATING_TASK", sequenceName = "SEQ_UPDATING_TASK")
public class UpdatingTask extends PropertizedEntity {
	private Long id;

	private StatusTransiction transictionStatus;

	private Date date;

	private Member updater;

	private Member newResponsible;

	@Id
	@GeneratedValue(generator = "SEQ_UPDATING_TASK")
	@Column(name = "COD_UPDATING_TASK", nullable = false)
	@Documentation("UPDATING TASK ID")
	public Long getId() {
		return this.id;
	}

	@Index(suffix = "0")
	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "COD_STATUS_TRANSICTION")
	@Documentation("STATUS TRANSICTION ID")
	public StatusTransiction getTransictionStatus() {
		return this.transictionStatus;
	}

	@Type(type = "bancosys.tec.persist.hibernate.type.DateType")
	@Column(name = "UP_DT", nullable = false)
	@Documentation("TASK UPDATING DATE")
	public Date getDate() {
		return this.date;
	}

	@Index(suffix = "1")
	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "COD_MEMBER_UPDATER", nullable = false)
	@Documentation("TASK UPDATER ID")
	public Member getUpdater() {
		return this.updater;
	}

	@Index(suffix = "2")
	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "COD_MEMBER_RESPONSABLE")
	@Documentation("TASK RESPONSABLE ID")
	public Member getNewResponsible() {
		return this.newResponsible;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setTransictionStatus(StatusTransiction transictionStatus) {
		this.transictionStatus = transictionStatus;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public void setUpdater(Member updater) {
		this.updater = updater;
	}

	public void setNewResponsible(Member newResponsible) {
		this.newResponsible = newResponsible;
	}

	@Override
	@Transient
	protected Set<Property> getEntityProperties() {
		return Collections.emptySet();
	}

}
